package com.example.interesting.desensitization.realize;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author fyw
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(value = ElementType.FIELD)
@JacksonAnnotationsInside
@JsonSerialize(using = DesensitizationSerializer.class)
public @interface Desensitization {

    /**
     * 脱敏数据类型，默认自定义
     */
    DesensitizationEnum type() default DesensitizationEnum.CUSTOM;

    /**
     * 左侧保留的长度
     */
    int leftRetentionLength() default 1;

    /**
     * 右侧保留长度
     */
    int rightRetentionLength() default 0;

}
